Backgrounds and Foregrounds

Backgrounds and Foreground shaders can be used to perform simple image-manipulation operations.

 

In particular, background shaders determine the color of pixels behind the geometry in the scene, while foreground shaders determine the relationship between the color of the visible surface at a pixel and the color that is actually displayed at that pixel.

 

When a shaded image is rendered, often not all pixels of the resulting image are covered in whole or in part by models you have created. The shading of these pixels is governed by the current background shader. A background shader calculates its shade based upon pixel location, and is therefore independent of the view specification.

 

Examples of background shaders are plain and graduated colors, complex patterns, and images generated by previous renderings or scanned from a photograph. When an image is used as a background, simple compositing functions may be performed so that, for example, a rendered image of a building may be superimposed upon a photograph of the site in order to create a more representative visualization. Backgrounds provide a means of improving the visual complexity of an image at a low computational cost.

 

When the color of the visible surface at a pixel has been evaluated, the current foreground shader may be invoked to perform image 'post-processing' operations to modify the color in someway before it is output as the pixel value. Examples of such operations are attenuation to simulate atmospheric phenomena such as fog, or depth cueing.

 

Only a single background and a single foreground may be active at any time, and when a background or foreground is activated, it becomes the 'current' one, replacing any other of that class that may have been previously active.

 

Interesting effects can be achieved simply by mixing two other backgrounds thanks to the "mixed" background shader, to which two other background shaders are specified, along with a mixing ratio.

 

Note: Background and Foreground shaders are not assigned to objects but to the entire scene. No objects must therefore be selected when you activate them.